<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>第四课</title>
</head>
<body>

switch case break default中使用 === 不带自动类型转换
效率并不及if

使用break退出当前结构~
var round = 0;
while(round<3){
console.log('ca'+round)
if(round==2){
console.log('e');
break;
}
round++;
}

Math.random() : 0<=μ<1
任意min-max之间取随机数
公式： parseInt(Math.random()*(max-min+1)+min)


<!-- example -->
<script>
  /**
   * @example 随机数
   * @param  {[type]} max [description]
   * @param  {[type]} min [description]
   * @return {[type]}     [description]
   */
  var getNum = function (max, min) {
    return parseInt(Math.random() * (max - min + 1) + min);
  };
  getNum(10, 0);

  // @example while 某闰年练习
  var count = 0;
  var year = 2001;
  while (count < 5) {
    if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
      console.log(year);
      count++;
    }
    year++;
  }

  // @example 输出乘法表
  for (var n = 1; n <= 9; n++) {
    var _srt = '';
    for (var i = 1; i <= n; i++) {
      _srt += (i + '*' + n + '=' + (i * n) + ' ');
    }
    console.log(_srt);
  }
</script>
</body>
</html>
